﻿Public Class LinkPhimDAO
    Public Shared Sub ThemLinkphim(ByVal link As LinkPhimDTO)
        Dim sql As String = "insert into LINKPHIM(ChatLuong,LinkPhim,MaPhim,DaoDien,NamSanXuat) values('" + link.chatLuong.ToString() + _
            "','" + link.linkPhim + "','" + link.maPhim + "',N'" + link.daoDien + "'," + link.namSanXuat.ToString() + ")"
        DataProvider.ExcuteQuery(sql)
    End Sub
    Public Shared Function loadLink(ByVal link As LinkPhimDTO) As DataTable
        Dim sql As String = "select LinkPhim from LINKPHIM where MaPhim= '" + link.maPhim + "' and DaoDien=N'" + link.daoDien + _
            "' and NamSanXuat= " + link.namSanXuat.ToString() + " and ChatLuong=" + link.chatLuong.ToString() + ""
        Dim dt As New DataTable
        dt = DataProvider.DataTable(sql)
        Return dt
    End Function

    Public Shared Function xoaLink(ByVal link As LinkPhimDTO)
        Dim sql As String = "delete from LINKPHIM where MaPhim='" + link.maPhim + "' and DaoDien=N'" + link.daoDien + _
            "' and NamSanXuat=" + link.namSanXuat.ToString() + ""
        DataProvider.ExcuteQuery(sql)
    End Function

    Public Shared Function xoaLinkTheoCL(ByVal link As LinkPhimDTO)
        Dim sql As String = "delete from LINKPHIM where MaPhim='" + link.maPhim + "' and DaoDien=N'" + link.daoDien + _
            "' and NamSanXuat=" + link.namSanXuat.ToString() + " and ChatLuong= " + link.chatLuong.ToString() + ""
        DataProvider.ExcuteQuery(sql)
    End Function
End Class
